using System;

namespace PropertyExpression.ReactiveRelation
{
    public static class CalcRegistratorExtensions
    {
        public static Func<FuncCache, TCalcContext, Func<T, TResult>>
            CacheFunc<TCalcContext, T, TResult>(
            this ICalcRegistrator<TCalcContext> calcRegistrator,
            Func<TCalcContext, Func<T, TResult>> func)
        {
            return CachedFuncRegistrator.CacheFunc(func);
        }

        public static Func<FuncCache, TCalcContext, Func<T1, T2, TResult>>
            CacheFunc<TCalcContext, T1, T2, TResult>(
            this ICalcRegistrator<TCalcContext> calcRegistrator,
            Func<TCalcContext, Func<T1, T2, TResult>> func)
        {
            return CachedFuncRegistrator.CacheFunc(func);
        }

        public static Func<FuncCache, TCalcContext, Func<T1, T2, T3, TResult>>
            CacheFunc<TCalcContext, T1, T2, T3, TResult>(
            this ICalcRegistrator<TCalcContext> calcRegistrator,
            Func<TCalcContext, Func<T1, T2, T3, TResult>> func)
        {
            return CachedFuncRegistrator.CacheFunc(func);
        }

        public static Func<FuncCache, TCalcContext, Func<T1, T2, T3, T4, TResult>>
            CacheFunc<TCalcContext, T1, T2, T3, T4, TResult>(
            this ICalcRegistrator<TCalcContext> calcRegistrator,
            Func<TCalcContext, Func<T1, T2, T3, T4, TResult>> func)
        {
            return CachedFuncRegistrator.CacheFunc(func);
        }

        public static Func<FuncCache, TCalcContext, Func<T, TResult>>
            CacheFuncWithArgument<TCalcContext, T, TResult>(
            this ICalcRegistrator<TCalcContext> calcRegistrator,
            Func<TCalcContext, Func<T, TResult>> func)
            where T : ICachedFuncArgument
        {
            return CachedFuncRegistrator.CacheFuncWithArgument(func);
        }
    }
}